package com.sqkj.dao;

import com.sqkj.entity.Help_other;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface Help_otherDao {
    //增加一个互助
    @Insert("insert into help_other(userId,name,sex,Hometown,IDCard,Phone,address,reason,amount,type,status) values(#{userId},#{name},#{sex},#{Hometown},#{IDCard},#{Phone},#{address},#{reason},#{amount},#{type},0) ")
    public int add(Help_other help_other);
    @Select("select * from help_other where userId = #{userId} and status = #{status}")
    public Help_other findByUserIdAndStatus(@Param("userId") int userId,@Param("status") int status);
    @Select("select * from help_other where userId = #{userId}")
    public List<Help_other> findByUserId(int userId);
    @Select("select * from help_other where status = 1")
    public List<Help_other> findBySuccessStatus();
}
